var swiper = new Swiper('.swiper-container', {
    slidesPerView: 3,
    spaceBetween: 30,
    slidesPerGroup: 3,
    loop: true,
    loopFillGroupWithBlank: true,
    pagination: {
        el: '.swiper-pagination',
        clickable: true,
    },
    navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
    },
});



var e = document.querySelector("#e");
var x = document.querySelector("#x");

//移入分类按钮
e.addEventListener("mouseover",function(){
    //移入的时候，执行显示分类详情
    x.style.display ="block";
});
e.addEventListener("mouseleave",function(){
    x.style.display ="none";
});
//移入详情
x.addEventListener("mouseover",function(){
    x.style.display ="block";
});
//移出详情
x.addEventListener("mouseleave",function(){
    x.style.display="none";
});


var toTop = document.querySelector("#toTop");
//    滚动条事件，滚动触发一次，这个事件执行一次
window.onscroll = function(){
    console.log(document.documentElement.scrollTop || document.body.scrollTop);
//        判断它距离顶部的位置
    if(document.documentElement.scrollTop > 1000 || document.body.scrollTop > 1000){
        toTop.style.display = "block";
    }else{
        toTop.style.display = "none";
    }
};

toTop.addEventListener('click', function (){
//        滚动到指定的位置
    window.scrollTo(0,0);
//        widow.scrollTo({
//            top:0,
//            behavior:'smooth'
//        });
});